package com.example.damaimaven.mapper;

import com.example.damaimaven.entity.Category;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Many;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author zzh
 * @since 2024-07-09
 */
public interface CategoryMapper extends BaseMapper<Category> {

    @Select("select * from category")
    //自定义结果集映射
    @Results(value={
            //字段映射
            @Result(column = "cid", property = "cid"),
            //一对多关联配置
            @Result(column = "cid", property = "categoryseconds",
                    many = @Many(select = "com.example.damaimaven.mapper.CategorysecondMapper.selectByCid"))
    })
    List<Category> selectAll();



}
